 docker rm $(docker ps -a -q)

 docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)
 
 docker run --name 192.168.31.81 -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul \
      # -h $HOSTNAME \
      -p 8300:8300 \
      -p 8301:8301 \
      -p 8301:8301/udp \
      -p 8302:8302 \
      -p 8302:8302/udp \
      -p 8400:8400 \
      -p 8500:8500 \
      -p 53:53/udp \
      agent -ui  -client 192.168.31.81 \
      -advertise 192.168.31.81 -join 10.211.55.11 \
      -bootstrap-expect=2

docker run -d --name node1 -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -server  -node=node1 -bootstrap-expect=2

JOIN_IP="$(docker inspect -f '{{.NetworkSettings.IPAddress}}' node1)"

docker run -d --name node2 -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -server  -node=node2 -join $JOIN_IP

docker run -d --name node3 -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -server  -node=node3 -join $JOIN_IP

docker run --name node11 -p 8400:8400 -p 8500:8500 -p 8600:53/udp -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -ui -node=node11 -client=0.0.0.0 -join $JOIN_IP


http://192.168.31.81:8500/ui/#/dc1/services

Failed to join 10.211.55.11: dial tcp 10.211.55.11:8301: connect: connection refused